home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
misc
/
football
/
user
/
reformat_schedule.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-11-29
|
5KB
|
176 lines
/* Mode=Run */
/* ***********************************************************************
Reformat_Schedule.rexx v1.1 (03-7-99) for THE FOOTBALL REXX SUITE
-----------------------------------------------------------
by Mark Naughton
update by Heiko Schroeder (age@thepentagon.com)
-This script formats a schedule file from DDMM to DDMMYYYY.
-To use Reformat_Schedule.rexx you have to create a schedule file
with dates in DDMM.
-The first line is to write
*DATES=DDMMYYYY
It means the first date of a game at season. E.g. *DATES=07081999
Version Date History
--------------------------------------------------------------------------
1.0 270599 First release.
1.1 030799 Update by Heiko Schroeder
Fixes problem by starting with program football
Automatically parsing of startmnth and year1, year2
Variable start month of a season (not only July (7))
Checks if the file has been reformatted
250899 Added error messages and title. Update by Mark.
280899 Converted to use locale. Some error messages, before
reading the locale, will still be in English.
190999 Changed schedule directory.
************************************************************************** */
parse arg filen /* only filen will be give by main program */
if open(datafile,"Data/Football.locale",'r') then do
line = readln(datafile)
locdir = strip(line)
close(datafile)
end
else do
say
say "ERROR : (ReformatSchedule)"
say
say "Cannot read 'Data/Football.locale' for the locale settings."
exit
end
locdir = locdir"User/Reformat_Schedule.data"
if open(datafile,"ENV:FootballRXPath",'r') then do
line = readln(datafile)
rxdir = strip(line)
close(datafile)
end
else
rxdir = "SYS:Rexxc/"
if exists(locdir) > 0 then do
address command rxdir'rx 'locdir
VarCount = getclip('VarCount')
do i = 1 to VarCount
interpret getclip('var.'i)
end
end
else do
say
say "ERROR : (ReformatSchedule)"
say
say "Cannot find '"locdir"' to read locale settings."
exit
end
say
say center(rs_three,78)
say "-------------------------------------------------------------------------------"
say
say rs_four
say
filen = strip(filen)
okay=0
exit=0
if exists("Data/Schedules/"filen".schd") = 0 then do
say
say rs_error
say
say rs_one"'Data/Schedules/"filen".schd'."
exit
end
if open(datafile,"Data/Schedules/"filen".schd",'r') then do
if open(datafile2,"Data/Schedules/"filen".schd2",'w') then do
do while ~eof(datafile) & exit=0
line = readln(datafile)
if line = '' then leave
if line ~= '' & pos('*',line) = 0 then do
counter = words(line)
do i=1 to counter
sdate = word(line,i)
If length(sdate)>4 then do /* check if it's correct file */
say rs_txt1
say
say rs_txt2
say rs_txt3
exit=1; okay =0
Leave
End
mnth = substr(sdate,3,2)
if mnth >= startmnth then /* changed */
sdate = sdate||year1" "
else do
if mnth < startmnth & mnth ~= 0 then /* changed */
sdate = sdate||year2" "
else
sdate = sdate||"0000 "
end
writech(datafile2,sdate)
end
writeln(datafile2,"")
end
else
if length(line) = 15 & pos('*DATES=',line) > 0 then do
/* parsing of startmonth, year1, year2 */
startmnth = strip(substr(line,10,2),'L',0)
year1 = substr(line,12,4)
year2 = year1 + 1
writeln(datafile2,line)
okay=1
end
else do
/* no parsing of startmonth, year1, year2 possible */
say rs_error
say
say rs_txt4"'"filen".schd'"rs_txt5
say rs_txt6
say
leave
end
end
close(datafile2)
end
else do
close(datafile)
say
say rs_error
say
say rs_two"'Data/Schedules/"filen".schd2'"rs_txt7
exit
end
close(datafile)
end
else do
say
say rs_error
say
say rs_two"'Data/Schedules/"filen".schd'"rs_txt8
exit
end
/* only if reformatting was successful the message will be appear */
If okay=1 then do
say rs_txt1
say
say rs_txt9"'"filen".schd2'."
end
exit